#pragma once
#include "udp_socket.hpp"

class Udp_client
{
public:
    Udp_client(const std::string &ip, const uint16_t &port) : ip_(ip), port_(port)
    {
        assert(sock_.Socket());
    }
    ~Udp_client()
    {
        sock_.Close();
    }
    bool RecvFrom(std::string *buf)
    {
        return sock_.RecvFrom(buf); //????????
    }
    bool SendTo(const std::string &buf)
    {
        return sock_.SendTo(buf,ip_,port_);
    }

private:
    UdpSocket sock_;
    std::string ip_;
    std::uint16_t port_;
};